<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <!-- Bootstrap -->
    <link href="../../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="../../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- NProgress -->
    <link href="../../vendors/nprogress/nprogress.css" rel="stylesheet">
    <!-- iCheck -->
    <link href="../../vendors/iCheck/skins/flat/green.css" rel="stylesheet">
    <!-- Custom Theme Style -->
    <link href="../../vendors/custom/custom.min.css" rel="stylesheet">
    <!--Bootstrap-table-->
    <link href="../../vendors/bootstrap-table/dist/bootstrap-table.css" rel="stylesheet">
    <link href="../../vendors/jquery/jquery.treegrid.min.css" rel="stylesheet">
    <!--自定义样式覆盖-->
    <style>
        body {
            background: #F7F7F7;
        }

        .cards {
            display: block;
        }

        .img-div {
            display: inline-block;
            margin-left: 20px;
        }

        .card {
            cursor: pointer;
            margin-top: 10px;
            width: 200px;
            box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
            text-align: center;
            transition: all 0.25s;
        }

        .card:hover {
            /*margin-top: 0px;*/
            box-shadow: 5px 8px 5px #778899;
        }

        .header {
            background-color: black;
            /*margin: 0 auto;*/
            /*padding: 40px;*/
        }

        .body {
            padding: 10px;
        }

        .card img {
            width: 100%;
        }

    </style>
</head>
<body id="body">
</body>


<!--JS插件引入-->

<!--jQuery -->
<script src="../../vendors/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="../../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="../../vendors/fastclick/lib/fastclick.js"></script>
<!-- NProgress -->
<script src="../../vendors/nprogress/nprogress.js"></script>
<!-- iCheck -->
<script src="../../vendors/iCheck/icheck.min.js"></script>
<!--Bootstrap-table-->
<script src="../../vendors/bootstrap-table/dist/bootstrap-table.js"></script>
<script src="../../vendors/bootstrap-table/dist/extensions/treegrid/bootstrap-table-treegrid.js"></script>
<script src="../../vendors/jquery/jquery.treegrid.min.js"></script>
<script src="../../vendors/bootstrap-table/dist/locale/bootstrap-table-zh-CN.js"></script>
<!-- Custom Theme Scripts -->
<script src="../../vendors/custom/custom.min.js"></script>
<!--myself script-->
<script src="../../vendors/myself/myself.js"></script>

<script type="text/javascript">

</script>

<script type="text/javascript">
    $(function () {
        $.ajax('/product/getpics', {
            type: 'post',
            success: function (data) {
                var cards_div = '<div class="cards"></div>'
                $.each(data.rows, function (i, rows) {
                    $('#body').append(cards_div);
                    $('#body').children('div:last-child').append('<div class="card img-div">' +
                        '<div class="header">' +
                        '<img src="' + rows.url + '" style="width:200px;height:200px;"/></div>' +
                        '<div class="body">' +
                        '<p>' + rows.name + '</p>' +
                        '</div></div>');

                    if (rows.urls[0] != null) {
                        // 子图片
                        $.each(rows.urls, function (i, url) {
                            $('#body').children('div:last-child').append('<div class="card img-div" style="width: 150px">' +
                                '<div class="header">' +
                                '<img src="' + url + '" style="width:150px;height:130px;"/></div>' +
                                '<div class="body">' +
                                '<p>' + rows.name + '(' + (i+1) + ')' + '</p>' +
                                '</div>');
                        })
                    }
                });
            }
        });
    });
</script>


</body>
</html>